import { Observable, throwIfEmpty } from "rxjs";

const source = new Observable((subscriber) => {
  // subscriber.next(1);
  //没有生产任何的值，直接完成
  subscriber.complete();
})
  .pipe(
    // 如果没有，执行subscriber.next();，直接subscriber.complete();完成， throwIfEmpty()会抛异常
    throwIfEmpty()
  )
  .subscribe({
    next: console.log,
    error: console.error,
  });
